package databaseTransaction;

import java.util.ArrayList;
import java.util.List;

public class Table {
	private String name;
	private List<TableField> fields;
	private List<TableField> id; // use list of field as ID
	private List<Command> commands;
	private boolean isGenerateHibernate;
	private boolean isOveride;
	private boolean isExist;

	public boolean isExist() {
		return isExist;
	}

	public void setExist(boolean isExist) {
		this.isExist = isExist;
	}

	public boolean isOveride() {
		return isOveride;
	}

	public void setOveride(boolean isOveride) {
		this.isOveride = isOveride;
	}

	public Table() {
		fields = new ArrayList<TableField>();
		this.name = "";
		this.id = new ArrayList<TableField>();
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public List<TableField> getTableFields() {
		return this.fields;
	}

	public void setTableFields(List<TableField> tableFields) {
		this.fields = tableFields;
	}

	public void addField(TableField field) {
		this.fields.add(field);
	}

	public List<TableField> getId() {
		return id;
	}

	public void setId(List<TableField> id) {
		this.id = id;
	}

	public void addId(TableField idField) { // use addId method in parser
		this.id.add(idField);
	}

	public List<Command> getCommands() {
		return commands;
	}

	public void setCommands(List<Command> commands) {
		this.commands = commands;
	}

	public void addCommand(Command command) {
		if (commands == null)
			commands = new ArrayList<Command>();
		commands.add(command);
	}

	public boolean isGenerateHibernate() {
		return isGenerateHibernate;
	}

	public void setGenerateHibernate(boolean isGenerateHibernate) {
		this.isGenerateHibernate = isGenerateHibernate;
	}
}